import React, { PureComponent } from 'react';
import { List, ActionSheet } from 'antd-mobile';
import { connect } from 'dva';
import { createForm, formShape } from 'rc-form';
import self from './index.less'
let wrapProps;
if (new RegExp('\\biPhone\\b|\\biPod\\b', 'i').test(window.navigator.userAgent)) {
    wrapProps = {
        onTouchStart: e => e.preventDefault(),
    };
}
@connect(({ Self }) => ({ Self }))
class Self extends PureComponent {
    constructor(props, context) {
        super(props, context)
    }

    showActionSheet = () => {
        const BUTTONS = ['2', 'Cancel'];
        ActionSheet.showActionSheetWithOptions({
            options: BUTTONS,
            message: 'I am description, description, description',
            maskClosable: true,
            wrapProps,
        },
            (buttonIndex) => {
                this.setState({ clicked: BUTTONS[buttonIndex] });
            });
    }
    test() {
        this.props.dispatch({ type: "auth/redirect", payload: { url: "/userInformation" } })
    }
    // cycle
    render() {
        const { Item } = List, { Brief } = Item;
        // this.showActionSheet.bind(this)
        return (
            <div className="self">
                <div className={self.my}>
                    <img src="https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1932504364,1198508086&fm=26&gp=0.jpg" alt="" />
                    <div>
                        <b>玉阳</b>
                        <p>学号：{13256149717}</p>
                    </div>
                </div>
                <List renderHeader={() => '人员管理'} className="my-list">
                    <Item extra={''}><span style={{ fontSize: '1rem' }}>学生社会关系管理</span></Item>
                    <Item extra={''}><span style={{ fontSize: '1rem' }}>学生经历管理</span></Item>
                    <Item extra={''} onClick={this.test.bind(this)}><span style={{ fontSize: '1rem' }}>个人基本信息</span></Item>
                </List>
                <List renderHeader={() => '学籍管理'} className="my-list">
                    <Item extra={''}><span style={{ fontSize: '1rem' }}>学籍确认</span></Item>
                    <Item extra={''}><span style={{ fontSize: '1rem' }}>学籍异动申请</span></Item>
                </List>
                <List renderHeader={() => ''} className="my-list" onClick={s=>this.props.dispatch({ type: "auth/logOut" })}>
                    <Item extra={''}><span style={{ fontSize: '1rem', color: 'red' }}>注销登录</span></Item>
                </List>
            </div>
        );
    }
}
export default Self;
